

//效期预警时间
const expMaxDay = 30

//异常提示颜色
const errColor = 'red'
/**报表样式处理方法
 */
const reportClassFuns = {
  //库存效期提醒报表
  stockExpNotice(rowData, fieldName) {
    let classOb = {}
    //效期过期，高亮效期和可用天数字段
    if (Number(rowData.due) < expMaxDay && (fieldName == 'due' || fieldName == 'exp_date')) classOb.color = errColor
    return classOb
  }, //科室耗占比
  reportHisBill(rowData, fieldName) {
    let classOb = {}
    if (String(rowData.per).indexOf('%') == -1)  rowData.per += '%'


    return classOb
  },
  //科室执行有效计费
  reportDeptHisBill(rowData, fieldName) {
    let classOb = {}
    if ((fieldName == 'qty' || fieldName == 'sn' || fieldName == 'bus_type') && rowData.his_status == 1) classOb.color = errColor
    return classOb
  },
  //病人消耗明细
  deptOprtUseDtlCss(rowData, fieldName) {
    let classOb = {}
    if (rowData.sku_price != rowData.his_price) classOb.color = errColor
    return classOb
  },
  //预算预警报表
  budgetDtlWarn(rowData, fieldName) {
    let classOb = {}
    //超过安全额
    if ((fieldName == 'amount_use_month' || fieldName == 'amount_safe_month') && rowData.amount_use_month > rowData.amount_safe_month) classOb.color = errColor

    //超过安全量
    if ((fieldName == 'qty_use_month' || fieldName == 'qty_safe_month') && rowData.qty_use_month > rowData.qty_safe_month) classOb.color = errColor
    return classOb
  },
  //调价明细
  priceAdjustmentAll(rowData, fieldName) {
    let classOb = {}
    if (fieldName == 'sku_price_change' && rowData.sku_price_change < 0 ){
      classOb.color = errColor
    }

    return classOb
  }
}

export default reportClassFuns
